package com.zlm.tools.util.stream;

import java.util.Arrays;
import java.util.List;

/**
 * @author zlm
 * @date 2023/8/18
 */
public class EitherUtilTest {

    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);
        list.stream().map(EitherUtil.leftWithValue(t -> {
                    if((t&1) == 0){
                        return t*2;
                    }else{
                        throw new RuntimeException();
                    }
                }))
                .forEach(t -> System.out.println(t.getRight()+" : " + t.getLeft()));
    }
}
